getServer('app/allProducts', "", function(res) {
	console.log(JSON.stringify(res))
	//				console.log(res.data.code)
	$('.allProducts').html(editList(res.data.products))
});

function getindex() {
	getServer('app/index', "", function(res) {
		console.log(JSON.stringify(res))
		//				console.log(res.data.code)
		$('.rollContent').html(res.data.rollContent)
		$('.memberCount').html(res.data.memberCount)
		$('.memberCountDay').html(res.data.memberCountDay)
	});
}

//编辑产品列表
function editList(data) {
	var list = ""
	for(var i = 0; i < data.length; i++) {
		list += '<li class="mui-table-view-cell mui-media " id="' + data[i].id + '">'
		list += '<img class="mui-media-object mui-pull-left" src="' + serverUrl + 'upload/' + data[i].img + '">'
		list += ' <div class="mui-media-body">'
		list += data[i].name
		list += ' <p>￥ ' + data[i].price + ' <label class="mui-pull-right buy" >立即购买</label></p>'
		list += '</div>'
		list += '</li>'
	}
	return list;
}

//热销产品列表点击控制
$('.allProducts').on('tap', 'li', function() {
	console.log($(this).attr('id'))
	openurl('../product/product.html', JSON.stringify({
		id: $(this).attr('id')
	}))
	//页面跳转
})
$('.mui-slider-item').bind('tap', function() {
	openurl('../xygmlc/xygmlc.html')
})